﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CommonSearchView.aspx.cs"
    EnableViewStateMac="false" Inherits="XMK.Tadong.Web.Views.DataSearch.CommonSearchView" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <title><%: lang.Get("The home page")%></title>
    <link href="../../weblib/jqueryui-autocomplete/themes/ui-lightness/jquery.ui.all.css"
        rel="stylesheet" type="text/css" />
    <link href="../../weblib/skins/main.css" rel="stylesheet" type="text/css" />
    <link href="../../weblib/jquery.easyui/themes/default/easyui.css" rel="stylesheet"
        type="text/css" />
    <link href="../../weblib/jquery.easyui/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../webjs/core/config.js" type="text/javascript"></script>
    <script src="../../weblib/jquery/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="../../weblib/jquery/jquery.adaptor.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../weblib/jquery.easyui/jquery.easyui.min.js"></script>
    <script src="../../weblib/jqueryui-autocomplete/ui/jquery.ui.widget.js" type="text/javascript"></script>
    <script src="../../weblib/jqueryui-autocomplete/ui/jquery.ui.autocomplete.js" type="text/javascript"></script>
    <script src="../../weblib/jqueryui-autocomplete/ui/jquery.ui.core.js" type="text/javascript"></script>
    <script src="../../weblib/jqueryui-autocomplete/ui/jquery.ui.menu.js" type="text/javascript"></script>
    <script src="../../weblib/jqueryui-autocomplete/ui/jquery.ui.position.js" type="text/javascript"></script>
     <script src="../../webjs/core/getTargetTree.js" type="text/javascript"></script>
    <script type="text/javascript">

        var language = $.cookie('_language_');
        if (language == null || language == '') {
            document.write("<script src='../../Language/sys_language/zh.js'><\/script>");
        }
        else if (Number(language) == 1) {
            document.write("<script src='../../Language/sys_language/zh.js'><\/script>");
        }
        else if (Number(language) == 0) {
            document.write("<script src='../../Language/sys_language/en.js'><\/script>");
        }
   </script>
    <!--<script src="../../webjs/core/index.js" type="text/javascript"></script>-->
    <style type="text/css" media="screen">
        html, body
        {
            height: 100%;
            width: 100%;
        }
        body
        {
            margin: 0;
            padding: 0;
        }
    </style>
    <style type="text/css">
        #head
        {
        
        }
        
               
        .fm
        {
            clear: both;
            position: relative;
            z-index: 297;
        }
        
        .s_ipt_wr
        {
            width: 380px;
            height: 30px;
            display: inline-block;
            margin-right: 5px;
            background-position: 0 -96px;
            border: 1px solid #b6b6b6;
            vertical-align: top;
            z-index:1;
        }
        
        .s_ipt
        {
            width: 382px;
            height: 22px;
            margin: 5px 0 0 7px;
            padding: 0;
            background: #fff;
            border: 0;
            outline: 0;
            -webkit-appearance: none;
             z-index:0;
             BACKGROUND-COLOR: transparent;
                BORDER-BOTTOM: #ffffff 0px solid;
                BORDER-LEFT: #ffffff 0px solid;
                BORDER-RIGHT: #ffffff 0px solid;
                BORDER-TOP: #ffffff 0px solid;
                border-color: #ffffff #ffffff #ffffff #ffffff;
        }
        
           #dialog_id .datagrid-body td, #dialog_id .datagrid-footer td , #dialog_id  .datagrid-header td{
        border-width: 0 0px 0px 0;
        border-style: none;
        } 
          #dialog_id .datagrid-body
        {
            overflow-x:hidden;
        }
         #dialog_id .datagrid-header
        {
            display:none;
        }
        
        /* 去掉IE10自带的输入框XX */
        #txtKeyword::-ms-clear
        {
            display:none;
        }
        
        input::-ms-clear{display:none;}
        
        .bg
        {
            background-image: url("../../weblib/skins/images/icons_4879d3b8.png");
            background-repeat: no-repeat;
            _background-image: url("../../weblib/skins/images/icons_5a07887b.gif");
            background-repeat: no-repeat;
        }
        
        .s_btn
        {
            width: 95px;
            height: 32px;
            padding-top: 2px;
            font-size: 14px;
            padding: 0;
            background-color: #ddd;
            background-position: 0 -48px;
            border: 0;
            cursor: pointer;
        }
        
        .s_btn_wr
        {
            width: 97px;
            height: 34px;
            display: inline-block;
            background-position: -120px -48px;
            z-index: 0;
            vertical-align: top;
        }
        .t
        {
            font-weight: normal;
            font-size: medium;
            margin-bottom: 5px;
        }
        
        .ec_desc
        {
            line-height: 19px;
            margin-bottom:3px;
        }
        
        .ec_font_small
        {
            font-size: small;
           <%-- width:900px;--%>
            
        }
        
        .ec_meta
        {
            margin-top: 1px;
            line-height: 18px;
            color: #888;
        }
        
        .ec_date, .ec_url
        {
            color: green;
        }
        
        #content_left
        {
            width: 1000px;
            float: left;
            padding-left: 15px;
        }
        
        .ec_pp_top
        {
            margin-bottom: 20px;
            width: 830px;
            overflow: hidden;
        }
        
        .ec_pp_top .ec_title
        {
            width: 100%;
            overflow: hidden;
        }
        
        .ec_nowrap
        {
            white-space: nowrap;
            overflow: hidden;
            width:1000px;
        }
        
        h3
        {
            display: block;
            margin: 0;
            padding: 0;
            list-style: none;
        }
        
        h3 a
        {
            color:Blue;
            text-decoration:underline;
        }
        
        h3 a:hover, a:active
        {
            text-decoration:underline;
            cursor:pointer;
        }
        a:link,
         a:visited  
        {
            color:Blue;
            text-decoration: none;
            
        }
         a:hover,
         a:active
        {
            color: #004988;
            text-decoration: underline;
            cursor: pointer;
        }
        
        
        
         a.search
        {
            color:Black;
            font-weight:bold;
            text-decoration:none;
        }
      
        
        #commendcontainer
        {
            padding: 10px;
            width:80%;
            margin: 15px 0;
           
            border: 1px solid #4c95c7;
            height: 30px;
          
        }
        .search_header
        {
            height: 30px;
        }
        .search_header_left
        {
            float: left;
            width: 270px;
        }
        .search_header_right
        {
            margin-left: 280px;
            padding-right: 15px;
            line-height: 28px;
        }
        ul.search_tab_li
        {
            list-style: none;
            padding: 0 0 0 25px;
            margin: 0;
            height: 24px;
        }
        ul.search_tab_li li
        {
           /* border-left: 1px solid #4c95c7;
            border-right: 1px solid #4c95c7;
            border-top: 1px solid #4c95c7;*/
            cursor: pointer;
            float: left;
            width: 110px;
            text-align: center;
            /*background: #dbe5ee;*/
            font-weight:700;
            color:#666;
            line-height: 30px;
            height: 30px;
            border-bottom-style: none;
            border-bottom-color: inherit;
            border-bottom-width: medium;
        }
        ul.search_tab_li li:hover{background:#D1D1D1;}
        ul.search_tab_li li.current
        {
            background: #9e9ebd;
            color:#fff;
        }
        .search_list
        {
            padding: 10px;
            border: 1px solid #ccc;
        }
        #searchCount
        {
            color: #828080;
            text-align: right;
        }
        
   
        .search_input
        {   
            width:720px;
            height:30px;
            float: left;
           
        }
        #search_type
        {
            <%--background:#fff;--%>
            width: 70px;
            height: 15px;
            padding:7px 5px 3px;
            position: absolute;            
            top: 1px;
            left: 300px;
            color:#666666;
        }
 
 #dialog_userinfo.hovertable {
	font-family: verdana,arial,sans-serif;
	font-size:11px;
	color:#333333;
	border-width: 1px;
	border-color: #999999;
	border-collapse: collapse;
}
#dialog_userinfo.hovertable th {
	background-color:#c3dde0;
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #a9c6c9;
}
#dialog_userinfo.hovertable tr {
	background-color:#d4e3e5;
}
#dialog_userinfo.hovertable td {
	border-width: 1px;
	padding: 8px;
	border-style: solid;
	border-color: #a9c6c9;
}


table {
    *border-collapse: collapse; /* IE7 and lower */
    border-spacing: 0;
   
}

.bordered {
    border: solid #ccc 1px;
    -moz-border-radius: 6px;
    -webkit-border-radius: 6px;
    border-radius: 6px;
    -webkit-box-shadow: 0 1px 1px #ccc; 
    -moz-box-shadow: 0 1px 1px #ccc; 
    box-shadow: 0 1px 1px #ccc;         
}

.bordered tr:hover {
    background: #fbf8e9;
    -o-transition: all 0.1s ease-in-out;
    -webkit-transition: all 0.1s ease-in-out;
    -moz-transition: all 0.1s ease-in-out;
    -ms-transition: all 0.1s ease-in-out;
    transition: all 0.1s ease-in-out;     
}    
    
.bordered td, .bordered th {
    border-left: 1px solid #ccc;
    border-top: 1px solid #ccc;
    padding: 10px;
    text-align: left;    
}

.bordered th {
    background-color: #dce9f9;
    background-image: -webkit-gradient(linear, left top, left bottom, from(#ebf3fc), to(#dce9f9));
    background-image: -webkit-linear-gradient(top, #ebf3fc, #dce9f9);
    background-image:    -moz-linear-gradient(top, #ebf3fc, #dce9f9);
    background-image:     -ms-linear-gradient(top, #ebf3fc, #dce9f9);
    background-image:      -o-linear-gradient(top, #ebf3fc, #dce9f9);
    background-image:         linear-gradient(top, #ebf3fc, #dce9f9);
    -webkit-box-shadow: 0 1px 0 rgba(255,255,255,.8) inset; 
    -moz-box-shadow:0 1px 0 rgba(255,255,255,.8) inset;  
    box-shadow: 0 1px 0 rgba(255,255,255,.8) inset;        
    border-top: none;
    text-shadow: 0 1px 0 rgba(255,255,255,.5); 
}

.bordered td:first-child, .bordered th:first-child {
    border-left: none;
}

.bordered th:first-child {
    -moz-border-radius: 6px 0 0 0;
    -webkit-border-radius: 6px 0 0 0;
    border-radius: 6px 0 0 0;
}

.bordered th:last-child {
    -moz-border-radius: 0 6px 0 0;
    -webkit-border-radius: 0 6px 0 0;
    border-radius: 0 6px 0 0;
}

.bordered th:only-child{
    -moz-border-radius: 6px 6px 0 0;
    -webkit-border-radius: 6px 6px 0 0;
    border-radius: 6px 6px 0 0;
}

.bordered tr:last-child td:first-child {
    -moz-border-radius: 0 0 0 6px;
    -webkit-border-radius: 0 0 0 6px;
    border-radius: 0 0 0 6px;
}

.bordered tr:last-child td:last-child {
    -moz-border-radius: 0 0 6px 0;
    -webkit-border-radius: 0 0 6px 0;
    border-radius: 0 0 6px 0;
}




        .paginatorali { font: 12px Arial, Helvetica, sans-serif;padding:10px 20px 10px 15px;}
        .paginatorali a {border:solid 1px #ccc;color:#0063dc;cursor:pointer;text-decoration:none;}
        .paginatorali a:visited {padding: 1px 6px; border: solid 1px #ddd; background: #fff; text-decoration: none;}
        .paginatorali .cpb {border:1px solid #F50;font-weight:700;color:#F50;background-color:#ffeee5;}
        .paginatorali a:hover {border:solid 1px #F50;color:#f60;text-decoration:none;}
        .paginatorali a,.paginatorali a:visited,.paginatorali .cpb,.paginatorali a:hover  
        {
            float:left;height:26px;line-height:26px;min-width:10px;_width:26px;margin-right:5px;text-align:center;
            white-space:nowrap;font-size:12px;font-family:Arial,SimSun;padding:0 3px;
        }
       
          </style>
    <script type="text/javascript">
        var user_id; //全局变量，保存用户id
        var g_pw;
        var g_proc;
        var tablecode;
        var table_id;
        //var haveDownExcelRight = false; //导出结构化表excel权限
        var haveSeeRight = false; //在线预览权限


        $(function () {
            $($(".paginatorali")[2]).hide();
            $("#search_list").height($(window).height() - $("#head").height() - $("#search_header").height() - 30);
            //注销
            $("#a_exit").click(function () {

                $.ajax({
                    url: "/tadongserviceweb/Logoutauth.aspx",
                    type: 'post',
                    dataType: 'json',
                    data: { "data": $.oemCookie() },
                    success: function () {
                        $.cookieClear();
                        location.href = "/tadongweb/login.html";
                    }
                });

            });
            $("#clickGIS").click(function () {
                window.parent.window.clickGIS();

            });
            $("#clickSearch").click(function () {
                window.parent.window.clickSearch();

            });
            $("#clickSpace").click(function () {
                window.parent.window.clickSpace();

            });

            $("#a_userName").click(function () {
                //                $("#dialog_userinfo").dialog("open");
            });

            $(window).resize(function () {
                var winHeight = $(document.body).height() - 140;

            });

        });


        //#region 弹出层
        //{html:'', title:'', width:100, height:90}
        function popwindows(dialogobj) {
            var dialog = {
                dialog_mask: 'dialog_bg',
                dialog_id: 'dialog_id',
                dialog_close: 'dialog_close',
                init: function () {
                    $.extend(dialog, dialogobj);
                    dialog.checkId();
                    dialog.createdialog();
                },
                checkId: function () {
                    if ($("#" + dialog.dialog_id).length > 0) {
                        $("#" + dialog.dialog_mask, "#" + dialog.dialog_id).remove();
                    }
                },
                createdialog: function () {
                    var _dialoghtml = [];
                    _dialoghtml.push('<div id="dialog_bg" style="background:#000;width:100%;height:100%;position:fixed; _position:absolute; top:0;left:0; z-index: 20000;filter:alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity: 0.5;opacity: 0.5; "></div>');
                    _dialoghtml.push('<div id="' + dialog.dialog_id + '" style="background:#fff;position: absolute; z-index: 20001;border:1px solid #ccc;">');
                    _dialoghtml.push('<div style="background:#d5d5d5;height:24px;line-height:24px;padding:0 5px;"><span style="width:30px;float:right;cursor:pointer" title=' + lang.close + ' id="dialog_close">' + lang.close + '</span><span>');
                    _dialoghtml.push(dialog.title);
                    _dialoghtml.push('</span></div><div>');
                    _dialoghtml.push(dialog.html);
                    _dialoghtml.push('</div><div style="height:1px;clear:both;"></div></div>');
                    $('body').append(_dialoghtml.join(''));

                    $('#' + dialog.dialog_close).bind('click', function () {
                        dialog.close();
                    });

                    $("#" + dialog.dialog_id).css({ width: dialog.width + "px" });
                    if (dialog.height) { $("#" + dialog.dialog_id).css({ height: dialog.height + "px" }); }

                    $("#" + dialog.dialog_id).css({ left: ($(window).width() - $("#" + dialog.dialog_id).width()) / 2 + $(window).scrollLeft() + "px",
                        top: ($(window).height() - $("#" + dialog.dialog_id).height()) / 2 + $(window).scrollTop() + "px"
                    });
                },
                close: function () {
                    $("#" + dialog.dialog_mask + ",#" + dialog.dialog_id).remove();
                }
            }
            dialog.init();
            return dialog;
        }
        //#endregion
        var dataCache = [
                { "label": "塔里木油田" },
                { "label": "大庆油田" },
                { "label": "采油厂" },
                { "label": "八厂" },
                { "label": "井123" },
                { "label": "你必须知道的.NET" }
            ];
        var isnowarp = true;

        $(function () {

            //=============================搜索=============================

            $("#txtKeyword").autocomplete({
                source: function (request, response) {
                    $.ajax({
                        url: "../../Handlers/SearchAutoComplete.ashx?optype=query",
                        dataType: "json",
                        data: {
                            featureClass: "P",
                            style: "full",
                            maxRows: 10,
                            keyw_startsWith: request.term
                        },
                        success: function (data) {
                            if (data.count == 0) {
                                if (data[0].KeywID.toString() == "0") {
                                    response($.map(data, function (item) {
                                        return {
                                            label: item.Keyword,
                                            value: request.term + item.Keyword
                                        }
                                    }));
                                }
                                else {
                                    response($.map(data, function (item) {
                                        return {
                                            label: item.Keyword,
                                            value: item.Keyword
                                        }
                                    }));
                                }
                            }
                            else {
                                response($.map(data, function (item) {
                                    return {
                                        label: item.Keyword,
                                        value: request.term + item.Keyword
                                    }
                                }));
                            }
                        }
                    });
                },
                minLength: 1,
                delay: 600,
                position: { my: "left-8 top+4 right-10" }
            });

            $("h3[class='t ec_nowrap'] a").click(function () {

                var fileId = $(this).attr("id");
                var space_type = $("#h_spaceType").val();
               
                // 查看文件是否存在
                $.post('../../Handlers/FileExistHandler.ashx?fileid=' + fileId + "&space_type=" + space_type,
                        {},
                        function (data) {
                            if (data.success && data.exist) {
                                GetUserFileRoleRight(fileId);
                            }
                            else {
                                alert(lang.File_converting);
                            }

                        });
            });

            $("#btnSearch").click(function () {
                if ($.trim($("#txtKeyword").val()) == "") {
                    return;
                }

                var liId = $("ul li.current").attr("id");
                if (liId == "li2") {
                    changeTab(2, 2, "");
                    return false;
                }
                else {
                    $.ajax({
                        url: "../../Handlers/SearchAutoComplete.ashx?optype=add",
                        dataType: "json",
                        data: {
                            keyw: $("#txtKeyword").val()
                        },
                        success: function (data) {

                        }
                    });

                    //结构化检索
                    //TODO 添加结构化检索代码


                    return true;
                }


            });

            $("#menu_list div[proc]").live('click', function () {
                var tabEngName = $(this).attr("id").toString();
                var tableCNName = $(this).attr("title");
                var procName = $(this).attr("proc");
                var keywText = $("#txtKeyword").val();
                g_proc = procName;
                g_pw = keywText;
                tablecode = tabEngName;

                $.post("../../Handlers/StructTableDictHandler.ashx?optype=getdict",
                {
                    tab_code: tabEngName
                },
                function (data) {

                    var cols = [];
                    for (var i = 0; i < data.length; i++) {
                        //                        cols.push({
                        //                            field: data[i].Col_Eng_Name.toUpperCase(),
                        //                            title: data[i].Col_CN_Name,
                        //                            width: data[i].Col_Width,
                        //                            align: data[i].Col_Align,
                        //                            sortable: data[i].Col_Sort
                        //                        });
                        if ($.cookie('_language_') == 1) {
                            cols.push({
                                field: data[i].FIELD_CODE.toUpperCase(),
                                title: data[i].FIELD_NAME,
                                width: data[i].FIELD_SHOWWIDTH,
                                align: data[i].COL_ALIGN,
                                sortable: data[i].FIELD_SHOW
                            });
                        }
                        else {
                            cols.push({
                                field: data[i].FIELD_CODE.toUpperCase(),
                                title: data[i].FIELD_CODE.toUpperCase(),
                                width: data[i].FIELD_SHOWWIDTH,
                                align: data[i].COL_ALIGN,
                                sortable: data[i].FIELD_SHOW
                            });
                        }
                    }

                    var icols = [];
                    icols.push(cols);

                    $('#dgTable').datagrid({
                        url: '../../Handlers/StructTableDictHandler.ashx?optype=querydata',
                        columns: icols,
                        method: "post",
                        queryParams:
                        {
                            proc: procName,
                            kw: keywText
                        },
                        rownumbers: true,
                        animate: true,

                        fit: true,
                        pageSize: 20,
                        pagination: true,
                        singleSelect: true,
                        pagePosition: 'top',
                        remoteSort: false
                    });

                    var buttons = [{
                        iconCls: 'icon-grid',
                        handler: function () {
                            if (isnowarp) {
                                $('#dgTable').datagrid({ nowrap: false });
                                isnowarp = false;
                            } else {
                                $('#dgTable').datagrid({ nowrap: true });
                                isnowarp = true;
                            }

                            //设置分页控件  
                            var p = $('#dgTable').datagrid('getPager');

                            $(p).pagination({
                                pageSize: 20, //每页显示的记录条数，默认为10  
                                pageList: [10, 20, 30], //可以设置每页记录条数的列表  
                                beforePageText: "", //页数文本框前显示的汉字  
                                afterPageText:"/{pages}",// lang.Page + "  " + lang.total + " {pages}" + lang.Page, //displayMsg: '',
                                displayMsg: lang.current_show + " {from} - {to} " + lang.Record + "  " + lang.total + " {total} " + lang.Record,
                                buttons: buttons

                            });
                        }
                    }, {
                        iconCls: 'icon-save',
                        handler: function () {
                            getUserDownStructRight();
                        }
                    }];
                    //设置分页控件  
                    var p = $('#dgTable').datagrid('getPager');

                    $(p).pagination({
                        pageSize: 20, //每页显示的记录条数，默认为10  
                        pageList: [10, 20, 30], //可以设置每页记录条数的列表  
                        beforePageText: "", //页数文本框前显示的汉字  
                        afterPageText: "/{pages}",//lang.Page + "  " + lang.total + " {pages}" + lang.Page, //displayMsg: '',
                        displayMsg: lang.current_show + " {from} - {to} " + lang.Record + "  " + lang.total + " {total} " + lang.Record,
                        buttons: buttons

                    });

                });
            });

            //==============================================================

        });


        //判断用户在线预览权限
        function GetUserFileRoleRight(fileId) {

            $.ajaxHandler({
                url: App_Config.TadongUrl + "/AjaxMappingHandler.aspx",
                urlType: "GetUserFileRoleRight",

                model: function () {
                    var obj = {};
                    obj.UserId = user_id;
                    obj.FileId = fileId;
                    obj.SpaceType = $("#h_spaceType").val();
                    obj.OpreType = "10";
                    return $.toJSON(obj);
                },
                success: function (data) {
                    if (data) {
                        var space = $("#h_spaceType").val();
                        ////                        window.open("WatchFileView.aspx?id=" + fileId + "&space_type=" + space, "_blank");
                        window.open("WatchViewHander.aspx?id=" + fileId + "&space_type=" + space, "_blank");
                    }
                    else
                        alert(lang.Insufficient_permissions_contact_your_administrator);
                }
            });
        }
        //判断用户导出权限-获取用户信息
        function getUserDownStructRight() {
            //根据当前表名获取表id
            $.ajaxHandler({
                url: App_Config.TadongUrl + "/AjaxMappingHandler.aspx",
                urlType: "GetCurTableInfoByTableCode",
                model: function () {
                    return tablecode;
                },
                success: function (data) {
                    if (data) {
                        table_id = data.table_id;
                        getUserDownStructRight1();
                    }
                }
            });

        }
        //断用户导出权限-获取权限
        function getUserDownStructRight1() {
            $.ajaxHandler({
                url: App_Config.TadongUrl + "/AjaxMappingHandler.aspx",
                urlType: "GetUserStructTableRight",
                model: function () {
                    var obj = {};
                    obj.UserId = user_id;
                    obj.TableId = table_id;
                    return $.toJSON(obj);
                },
                success: function (data) {
                    if (data) {
                        downloadExcel();
                    }
                    else {
                        alert(lang.Insufficient_permissions_contact_your_administrator);
                    }

                }
            });

        }
        function downloadExcel() {
            paths = "../../Default.aspx?kw=" + g_pw + "&proc=" + g_proc;
            $("#fileDownFrame").attr("src", paths);
        }


        //#endregion
        //#region 功能：tab标签切换
        function getstatissubmenu(data, parent_menuid, _html) {
            if (data.detail && data.detail.length > 0) {
                if (language == 1) {
                                    for (var i = 0; i < data.detail.length; i++) {
                                        if (data.detail[i].T_CAT == parent_menuid) {
                                            _html.push('<div class="submenu" id="' + data.detail[i].T_ENG_NAME + '" proc="'
                                                + data.detail[i].T_PROC_NAME + '" _title="' + data.detail[i].T_CN_NAME + '" >'
                                                + data.detail[i].T_CN_NAME + '(' + data.detail[i].CNT + ')</div>');
                                        }
                                    }
                }
                else {
                                    for (var i = 0; i < data.detail.length; i++) {
                                        if (data.detail[i].T_CAT == parent_menuid) {
                                            _html.push('<div class="submenu" id="' + data.detail[i].T_ENG_NAME + '" proc="'
                                                + data.detail[i].T_PROC_NAME + '" _title="' + data.detail[i].T_CN_NAME + '" >'
                                                + data.detail[i].T_ENG_NAME + '(' + data.detail[i].CNT + ')</div>');
                                        }
                                    }
                }
            }
            return _html;
        }

        function changeTab(n, count, s, style) {

            var key = $("#" + "<%=h_pagename.ClientID %>").val();
            addCookie(key, n, 0);

            for (var i = 1; i <= count; i++) {
                var liObj = document.getElementById(s + 'li' + i);
                var conObj = document.getElementById(s + 'tabContent' + i);
                if (i == n) {
                    if (style)
                        liObj.className = style;
                    else
                        liObj.className = 'current';
                    conObj.style.display = '';
                } else {
                    liObj.className = '';
                    conObj.style.display = 'none';
                }
            }

            $('#spanSearchResult').show();

            ///搜索
            if (n == 2) {

                $('#spanSearchResult').hide();

                if ($.trim($("#txtKeyword").val()) == "") {
                    return;
                }

                $.post("../../Handlers/StructTableDictHandler.ashx?optype=keywsearch",
                {
                    keyw: $.trim($("#txtKeyword").val())
                },
                function (data) {
                    if (data && data.success) {
                        var _html = [];
                        if (data.cat.length == 0) return;
                        for (var i = 0; i < data.cat.length; i++) {
                            if (language == 1) {
                                _html.push('<div title="' + data.cat[i].t_cat + '(' + data.cat[i].cnt + ')"  style="padding:10px;">');
                            }
                            else {
                                _html.push('<div title="' + data.cat[i].en_t_cat + '(' + data.cat[i].cnt + ')"  style="padding:10px;">');
                            }
                            var _subhtml = [];
                            getstatissubmenu(data, data.cat[i].t_cat, _subhtml);

                            _html.push(_subhtml.join('') + '</div>');
                        }

                        $('#menu_list_warp').html('<div id="menu_list" ></div>');
                        $('#menu_list').html(_html.join(''));

                        $('#menu_list').accordion({ animate: false, border: false });
                        $('#menu_list .panel-body .accordion-body').css({ border: 0 });
                        $('.accordion-noborder .accordion-body').css({ border: 0 });

                        $('#menu_list div[proc]:eq(0)').click();
                    }
                });
            }

        }
        //#endregion
    </script>
    <script type="text/javascript">
        //添加Cookie的方法
        function addCookie(objName, objValue, objHours) {//添加cookie
            var str = objName + "=" + escape(objValue);

            if (objHours > 0) {//为0时不设定过期时间，浏览器关闭时cookie自动消失
                var date = new Date();
                var ms = objHours * 3600 * 1000;
                date.setTime(date.getTime() + ms);
                str += "; expires=" + date.toGMTString();
            }
            document.cookie = str;
        }

        function getCookie(objName) {//获取指定名称的cookie的值
            var arrStr = document.cookie.split("; ");
            for (var i = 0; i < arrStr.length; i++) {
                var temp = arrStr[i].split("=");
                if (temp[0] == objName) return unescape(temp[1]);
            }
        }

        function delCookie(name) {//为了删除指定名称的cookie，可以将其过期时间设定为一个过去的时间
            var date = new Date();
            date.setTime(date.getTime() - 1110000);
            document.cookie = name + "=a; expires=" + date.toGMTString();
        }

        $(function () {
            //LoadCOunt为0，表示第一次加载
            if ($("#" + "<%=h_loadCount.ClientID %>").val() == "0") {
                if ($("#" + "<%=h_savecookie.ClientID %>").val() == "false") {
                    delCookie($("#" + "<%=h_pagename.ClientID %>").val());
                }
            }

            var key = $("#" + "<%=h_pagename.ClientID %>").val();
            var cookieValue = getCookie(key);
            //$('#dgTable').parent().height($(window).height() - 170);
            $('#dgTable').parent().height($(window).height() - 130);
            $('#tabContent2').height($(window).height() - 130);

            if ($("#" + "<%=h_outQueryTarget.ClientID %>").val() == "2") {
                changeTab(2, 2, '');
            }
            else {
                if (cookieValue == undefined || cookieValue == "") {
                    changeTab(1, 2, '');
                }
                else {
                    changeTab(cookieValue, 2, '');
                }
            }


        });

    </script>
</head>
<body style="font-size: 12px; padding: 0; margin: 0;">
    <iframe id="fileDownFrame" src="" style="display: none; visibility: hidden;"></iframe>
    <form id="form1" runat="server">
    <div id="head" style="width: 100%; height: 71px;">
        <div style="margin: 8px 0px 0px 0px; height: 63px;">
            <div style="text-align: left; width: 920px; height: 63px; clear: both;">
                <div class="sarch_logo" style="text-align: center; width: 186px; height: 56px; float: left;
                    overflow: hidden;">
                    <img src="../../weblib/skins/images/search_logo5.png" height="56" />
                </div>
                <div style="width: 715px; height: 56px; float: left; overflow: hidden; margin-bottom: 0px;">
                    <div style="height: 18px; width: 604px; margin-left: 20px; margin-bottom: 5px;" id="search_main">
                        <a href="#" class="search" id="clickSearch"><span style="font-size: 14px;"><%: lang.Get("Search")%></span></a>&nbsp;&nbsp;
                        <a href="#" class="space" id="clickSpace"><span style="font-size: 14px;"><%: lang.Get("Zone")%></span></a>&nbsp;&nbsp;
                        <a href="#" class="GIS" id="clickGIS"><span style="font-size: 14px;">GIS</span></a>&nbsp;&nbsp;
                        <a href="../../DataAssetsStatistics/AssetsStatistics.aspx" target="_blank"><span style="font-size: 14px;"><%: lang.Get("Statistical data assets")%></span></a>&nbsp;&nbsp;
                    </div>
                    <div class="search_input;" style="position: relative">
                        <div class="s_ipt_wr">
                            <asp:TextBox runat="Server" CssClass="s_ipt" ID="txtKeyword"></asp:TextBox>
                        </div>
                        <span class="bg s_btn_wr" style="margin-left: 12px;">
                            <asp:Button runat="Server" ID="btnSearch" CssClass="bg s_btn" CommandArgument="xmk"
                                Text='<%# lang.Get("project DB search")%>' OnClick="btnSearch_Click" />
                        </span><span class="bg s_btn_wr" style="margin-left: 12px;">
                            <asp:Button runat="Server" ID="btnTeamSearch" CommandArgument="team" CssClass="bg s_btn"
                                Text='<%# lang.Get("workgroup DB search")%>' OnClick="btnSearch_Click" />
                        </span><span style="margin-left: 12px; vertical-align: middle; margin-bottom: 5px;">
                            <a href="AdvancedSearchView.aspx" style="text-decoration: underline;"><%: lang.Get("Advanced search")%></a>
                        </span>
                        <%--<span class="bg s_btn_wr" style="margin-left: 12px;">
                            <asp:Button runat="Server" ID="btnTeamSearch" CssClass="bg s_btn" Text="课题组" OnClick="btnSearch_Click" />
                        </span>--%>
                        <input type="hidden" id="targetValue" name="targetValue" runat="server" />
                        <input type="hidden" id="bizValue" name="bizValue" runat="server" />
                        <div id="search_type" style="clear: left; z-index: 2;">
                            <span onclick="searchtype(0,'txtKeyword');" style="cursor: pointer;"><%: lang.Get("Object")%></span>｜<span
                                onclick="searchtype(1,'txtKeyword');" style="cursor: pointer;"><%: lang.Get("Business")%></span>
                        </div>
                    </div>
                </div>
            </div>
            <%--蓝线--%>
            <!--<div style="background-image: url('../../weblib/skins/images/line2.png'); width: 100%;
                height: 8px; margin: 0; position: relative;">
            </div>-->
        </div>
    </div>
    <%--<div style="margin:10px 30px;height: 20px;border:2px;">
        智能扩展
    </div>--%>
    <div class="searchtab">
        <div class="search_header" style="background: #dfdfdf;" id="search_header">
            <div class="search_header_left" style="margin: 0px 0px 0px 1px;">
                <ul class="search_tab_li">
                    <li class="current" id="li1" onclick="changeTab(1,2,'')" style="border-right: none;">
                        <%: lang.Get("Unstructured data")%></li><li id="li2" onclick="changeTab(2,2,'')"><%: lang.Get("Structured data")%></li>
                </ul>
            </div>
            <div class="search_header_right">
                <div runat="server" id="searchCount">
                </div>
            </div>
        </div>
        <div class="search_list" style="margin: 1px; overflow: auto" id="search_list">
            <div id="tabContent1">
                <div runat="Server" id="divContainer">
                </div>
                <webdiyer:AspNetPager ID="AspNetPager1" CssClass="paginatorali" CurrentPageButtonClass="cpb"
                    runat="server" AlwaysShow="False" FirstPageText="first" LastPageText="end" NextPageText="next"
                    PageSize="15" PrevPageText="up" ShowCustomInfoSection="Right" OnPageChanging="AspNetPager1_PageChanged"
                    ShowInputBox="Never" CustomInfoTextAlign="Left" LayoutType="Div">
                </webdiyer:AspNetPager>
                <div style="height: 1px; clear: both;">
                </div>
            </div>
            <div id="tabContent2" style="display: none;">
                <div style="width: 240px; float: left;">
                    <div id="menu_list_warp">
                        <div id="menu_list">
                        </div>
                    </div>
                    <div style="clear: both; height: 1px;">
                    </div>
                </div>
                <div style="margin-left: 250px; padding-right: 10px;">
                    <div id="dgTable">
                    </div>
                </div>
                <div style="clear: both; height: 1px;">
                </div>
            </div>
        </div>
        <asp:HiddenField ID="h_pagename" runat="server" />
        <asp:HiddenField ID="h_loadCount" runat="server" />
        <asp:HiddenField ID="h_savecookie" runat="server" />
        <asp:HiddenField ID="h_indexPath" runat="Server" />
        <asp:HiddenField ID="h_outQueryTarget" runat="Server" Value="1" />
        <asp:HiddenField ID="h_spaceType" runat="Server" Value="30" />

          <script type="text/javascript">
              if ($.browser.msie) {
                  if ($.browser.version == "10.0") {
                      $("<input />").attr("type", "hidden").attr("name", "__EVENTTARGET").attr("id", "__EVENTTARGET").appendTo("form");
                      $("<input />").attr("type", "hidden").attr("name", "__EVENTARGUMENT").attr("id", "__EVENTARGUMENT").appendTo("form");
                      $("<script />").attr("type", "text/javascript").attr("src", "../../webjs/core/aspnetForm.js").appendTo("form");  
                  }
              }

              /*
              var theForm = document.forms['form1'];
              if (!theForm) {
                  theForm = document.form1;
              }
              function __doPostBack(eventTarget, eventArgument) {
                  if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
                      theForm.__EVENTTARGET.value = eventTarget;
                      theForm.__EVENTARGUMENT.value = eventArgument;
                      theForm.submit();
                  }
              }
              */
    </script>
    </form>
</body>
</html>
